package com.platform.controller;

import com.platform.entity.MaterielBomEntity;
import com.platform.service.BomService;
import com.platform.service.OrderService;
import com.platform.utils.PageUtils;
import com.platform.utils.Query;
import com.platform.utils.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


/**
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2017-08-13 10:41:09
 */
@RestController
@RequestMapping("bom")
public class BomController {
    @Autowired
    private BomService bomService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("bom:list")
    public R list(@RequestParam Map<String, Object> params) {
        // 查询列表数据
        Query query = new Query(params);

        List<MaterielBomEntity> orderList = bomService.queryList(query);
        int total = bomService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(orderList, total, query.getLimit(), query.getPage());

        return R.ok().put("page", pageUtil);
    }
}
